use bevy::app::{App, Plugin, Startup};
use bevy::math::Vec3;
use bevy::prelude::{Camera3dBundle, Commands, Transform};
use bevy::utils::default;

const CAMERA_DISTANCE: f32 = 80.;

pub struct CameraPlugin;

impl Plugin for CameraPlugin {
    fn build(&self, app: &mut App) {
        app.add_systems(Startup, spawn_camera);
    }
}

fn spawn_camera(mut commands: Commands) {
    commands.spawn(Camera3dBundle {
        transform: Transform::from_xyz(0., CAMERA_DISTANCE, 0.).looking_at(Vec3::ZERO, Vec3::Z),
       ..default()
    });
}